#-------------------------------------------------------------------------------
# UMFPACK Makefile
#-------------------------------------------------------------------------------

SUITESPARSE ?= $(realpath $(CURDIR)/..)
export SUITESPARSE

default: all

include ../SuiteSparse_config/SuiteSparse_config.mk

# compile all C code (except hb, fortran, and fortran64), incl. AMD and demos
all:
	( cd Lib    ; $(MAKE) )
	( cd Demo   ; $(MAKE) )

# compile just the C-callable UMFPACK library
library:
	( cd Lib    ; $(MAKE) )

# compile the FORTRAN interface and demo program
fortran:
	( cd Demo   ; $(MAKE) fortran )

# compile the 64-bit FORTRAN interface and demo program
fortran64:
	( cd Demo   ; $(MAKE) fortran64 )

# compile the Harwell/Boeing demo program
hb:
	( cd Demo   ; $(MAKE) hb )

# remove object files, but keep the compiled programs and library archives
clean:
	( cd Lib    ; $(MAKE) clean )
	( cd Demo   ; $(MAKE) clean )
	( cd Doc    ; $(MAKE) clean )
	( cd MATLAB ; $(MAKE) clean )
	( cd MATLAB ; $(RM) $(CLEAN) rename.h )

# clean, and then remove compiled programs and library archives
purge:
	( cd Lib    ; $(MAKE) purge )
	( cd Demo   ; $(MAKE) purge )
	( cd Doc    ; $(MAKE) purge )
	( cd Tcov   ; $(MAKE) purge )
	( cd MATLAB ; $(MAKE) purge )

# create PDF documents for the original distribution
docs:
	( cd Doc    ; $(MAKE) )

# get ready for distribution
dist: purge
	( cd Demo   ; $(MAKE) dist )
	( cd Doc    ; $(MAKE) )

distclean: purge

ccode: library

lib: library

# statement coverage (requires Linux; takes a lot of time and disk space)
cov: purge
	( cd Tcov ; $(MAKE) )

# install UMFPACK
install:
	( cd Lib ; $(MAKE) install )

# uninstall UMFPACK
uninstall:
	( cd Lib ; $(MAKE) uninstall )

